package com.example.demo.Builder;

import java.util.Random;

public class saltBuilder {

    public int len;
    public String template="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    public saltBuilder(int length){
        len=length;
    }

    public String RandomSalt(){
        StringBuffer str = new StringBuffer();
        Random random = new Random();
        for(int i=0;i<len;i++){
            int index=random.nextInt(template.length());
            str.append(template.charAt(index));
        }
        return str.toString();
    }
}
